package day0925;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;


class Bird{
    int age;
}


class MC  implements Comparator<Bird>{
    public int compare(Bird o1, Bird o2) {
        return o1.age-o2.age;
    }//升序排列： 参数1  值   -  参数2 值
}
public class T3 {
    public static void main(String[] args) {
        ArrayList list=new ArrayList();
        Bird  b1=new Bird();       b1.age=13;       list.add(b1);
        Bird  b2=new Bird();       b2.age=1;        list.add(b2);
        //Collections.sort(list);//默认排序方式
        Collections.sort(list,new  MC());
        for(Object d:list){
            System.out.println(  ((Bird)d).age  );
        }  //默认排序方式
    }
}

